package promote.brozen.netty.bytebuf;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufUtil;
import io.netty.buffer.PooledByteBufAllocator;

/**
 * @author Brozen
 * @date 2020/9/30 5:11 PM
 * @email brozen@qq.com
 */
public class PooledBuf {

    public static void main(String[] args) {
        ByteBuf buf = PooledByteBufAllocator.DEFAULT.heapBuffer(1024 * 9);
        System.out.println(buf.capacity());
        buf.release();

        ByteBuf buf2 = PooledByteBufAllocator.DEFAULT.heapBuffer(100);
        System.out.println(buf2.capacity());

        ByteBuf buf3 = PooledByteBufAllocator.DEFAULT.heapBuffer(8 * 1024);
        System.out.println(buf3.capacity());

        buf3.release();

//        ByteBuf buf1 = PooledByteBufAllocator.DEFAULT.directBuffer();
//        System.out.println(buf1.capacity());

    }

}
